package library.operation.impl;

import library.book.BookList;
import library.operation.IOperation;

/**
 * 归还书籍操作
 */
public class ReturnOperation implements IOperation {
    @Override
    public void work(BookList bookList) {
        System.out.println("此时您正在进行的是还书操作");
        System.out.println("请输入您要还的书籍名称:");
        String booksName=scanner.next();

        if (bookList.isContains(booksName)){
            if (bookList.isBookBorrow(booksName)){
                bookList.returnBook(booksName);
                System.out.println("还书成功，欢迎下次再来~");
            }else{
                System.out.println("您没有借过这本书~");
            }
        }else {
            System.out.println("书架上没有这本书~");
        }
    }
}
